#include "trap.h"
    .set noreorder          # 禁止指令重排序
    .set nomacro            # 禁止使用伪指令
    .set noat               # 禁止使用$at寄存器
    .globl main
    .text

main: 
    # 初始化寄存器
    lui     $s0, 0x0FFF           # $s0 = 0x0FFF0000
    lui     $s1, 0x3EEE           # $s1 = 0x3EEE0000
    lui     $s2, 0x5BBB           # $s2 = 0x5BBB0000
    lui     $s3, 0x0000           # $s3 = 0x00000000
    lui     $t0, 0xFFFF           # $t0 = 0xFFFF0000
    lui     $t1, 0x8000           # $t1 = 0x80000000
    lui     $t2, 0xEEEE           # $t2 = 0xEEEE0000
    lui     $t3, 0x0000           # $t3 = 0x00000000

    # 调整寄存器值
    addiu   $s0, $s0, 0x7FFF      # $s0 = 0x0FFF7FFF
    addiu   $s1, $s1, 0x7EEE      # $s1 = 0x3EEE7EEE
    addiu   $s2, $s2, 0x7BBB      # $s2 = 0x5BBB7BBB
    addiu   $s3, $s3, 0x0001      # $s3 = 0x00000001
    addiu   $t0, $t0, 0x7FFF      # $t0 = 0xFFFF7FFF
    addiu   $t1, $t1, 0x0000      # $t1 = 0x80000000
    addiu   $t2, $t2, 0x7EEE      # $t2 = 0xEEEE7EEE
    addiu   $t3, $t3, 0x0000      # $t3 = 0x00000000

    # 有符号乘法操作
    mult    $s0, $s0              # hi=0x00FFF000, lo=0x20010001
    mult    $s1, $s1              # hi=0x0F7863AB, lo=0x89772544
    mult    $s3, $s1              # hi=0, lo=0x3EEE7EEE
    mult    $t0, $t0              # hi=0, lo=0x40010001
    mult    $t0, $t1              # hi=0x4000, lo=0x80000000
    mult    $t1, $t2              # hi=0x888C089, lo=0
    mult    $t3, $s0              # hi=0, lo=0
    mult    $s0, $t0              # hi=0xFFFFF800, lo=0x30010001
    mult    $s1, $t1              # hi=0xE088C089, lo=0
    mult    $t2, $s2              # hi=0xF9E24715, lo=0x710D11DA

    # 无符号乘法操作
    multu   $s0, $s0              # hi=0x00FFF000, lo=0x20010001
    multu   $s1, $s1              # hi=0x0F7863AB, lo=0x89772544
    multu   $s2, $s0              # hi=0x5BB89DD, lo=0x96670445
    multu   $s3, $s1              # hi=0, lo=0x3EEE7EEE
    multu   $t0, $t0              # hi=0xFFFEFFFE, lo=0x40010001
    multu   $t0, $t1              # hi=0x7FFFBFFF, lo=0x80000000
    multu   $t1, $t2              # hi=0x77773F77, lo=0
    multu   $t3, $s0              # hi=0, lo=0
    multu   $s0, $t0              # hi=0xFFF77FF, lo=0x30010001
    multu   $s1, $t1              # hi=0x1F773F77, lo=0
    multu   $t2, $s2              # hi=0x559DC2D0, lo=0x710D11DA

    # HI和LO寄存器操作
    nop
    mfhi    $t4                   # 将HI值存入$t4
    mflo    $t5                   # 将LO值存入$t5
    mthi    $s0                   # 将$s0存入HI
    mtlo    $s1                   # 将$s1存入LO
    mfhi    $t8                   # 将HI值存入$t8
    mflo    $t9                   # 将LO值存入$t9

    # 程序结束
    HIT_GOOD_TRAP                 # 停止模拟器